using System;
using System.Collections;
using InfoJetSoft.Service.Entity;

namespace InfoJetSoft.Service.ManagedCode
{
	/// <summary>
	/// Summary description for ViewInfos.
	/// </summary>
	public class ViewInfos : Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfosCollection
	{
		private ArrayList viewInfoList = null;
		
		public ViewInfos( Manifest manifest )
		{
			this.viewInfoList = new ArrayList();
			foreach( View view in manifest.ViewList )
			{
				ViewInfo viewInfo = new ViewInfo( manifest, view );
				this.viewInfoList.Add( viewInfo );
			}
		}

		public IEnumerator GetEnumerator()
		{
			return this.viewInfoList.GetEnumerator();
		}

		public int Count 
		{ 
			get
			{
				return this.viewInfoList.Count;
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View1
		{
			get
			{
				return this[ "View1" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View2
		{
			get
			{
				return this[ "View2" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View3
		{
			get
			{
				return this[ "View3" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View4
		{
			get
			{
				return this[ "View4" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View5
		{
			get
			{
				return this[ "View5" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View6
		{
			get
			{
				return this[ "View6" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View7
		{
			get
			{
				return this[ "View7" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View8
		{
			get
			{
				return this[ "View8" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View9
		{
			get
			{
				return this[ "View9" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject View10
		{
			get
			{
				return this[ "View10" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject this[object varIndex] 
		{ 
			get
			{
				if( varIndex is int )
				{
					return (Microsoft.Office.Interop.InfoPath.SemiTrust.ViewInfoObject)this.viewInfoList[ (int)varIndex ];
				}
				else
				{
					foreach( ViewInfo viewInfo in this.viewInfoList )
					{
						if( viewInfo.Name.Equals( varIndex ) )
						{
							return viewInfo;
						}
					}
					return null;
				}
			}
		}

	}
}
